package com.kamistoat.meimeimall.meimeimallware.learn;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * 自定义的ApplicationListener，在学习spring源码时使用到。
 */
public class LearnApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        System.out.println("自定义ApplicationListener监听器，监听ContextRefreshedEvent事件。获得的容器中初始化Bean的数量：" +
                contextRefreshedEvent.getApplicationContext().getBeanDefinitionCount());
    }
}
